//
//  PlatformApp.swift
//  kz
//
//  Created by Wai Yin Chan on 14/9/2017.
//  Copyright © 2017 Tech_001. All rights reserved.
//

import Foundation

protocol PlatformAppProtocol {
    var gpid: String { get }
    var name: String { get }
    var downloadParam: String { get }
    var url: URL? { get set }
    
    /**** Important to update self url before calling callback function ****/
    func routeGame(_ callback: @escaping (PlatformAppProtocol) -> Void)
}

class PlatformApp {
    public static func getInstance(_ gpid: String) -> PlatformAppProtocol? {
        let platform : [PlatformAppProtocol] = [
            EBetApp(),
            ManxSportsApp()
        ]
        
        for app in platform {
            if app.gpid == gpid {
                return app
            }
        }
        return nil
    }
}
